import { ActionInfo } from "../scene/modle/data/ActionInfo";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class FrameTypeAction
    
    export  class FrameTypeAction
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (FrameTypeAction._instance != null) 
            {
                throw new Error(" FrameTypeConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=0;
            var loc6=arg1.modle;
            for(loc4 of loc6) 
            {
                if (typeof loc4.action === "array") 
                {
                    var loc7=0;
                    var loc8=loc4.action;
                    for(loc3 of loc8) 
                    {
                        this._map[loc4.name + "_" + loc3.type] = new ActionInfo(loc3.type, loc3.startFrame, loc3.endFrame, loc3.frameRate, loc3.delay, loc3.dir);
                    }
                    continue;
                }
                loc3 = loc4.action;
                this._map[loc4.name + "_" + loc3.type] = new ActionInfo(loc3.type, loc3.startFrame, loc3.endFrame, loc3.frameRate, loc3.delay, loc3.dir);
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("frameType.xml");
            this.write(loc1);
            return;
        }

        public getActionInfo(arg1: string, arg2: int): ActionInfo
        {
            return this._map[arg1 + "_" + arg2];
        }

        public static get instance(): FrameTypeAction
        {
            if (FrameTypeAction._instance == null) 
            {
                FrameTypeAction._instance = new FrameTypeAction();
            }
            return FrameTypeAction._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: FrameTypeAction;
    }
